I don't.
I have stints of high motivation and stints of low motivation.
The trick is to be productive without being passionate about programming. "Choose a job you love and you will never have to work a day in your life" is a toxic mentality, and it's okay for work to just be work (sometimes or even all the time!).