Decouple the money from the solution. As soon as you realise that the money you earn is not dependant on the code you write you realise that the people you work with and for depend on you being top of your game and trust you.
This whole process of trying to be the best that you can be for a client who depends on you for the best possible solution enforces you to become a better programmer.
Yes at the end of the day its all about the money, but there comes a time when you can demand more money for the skills you bring to the table. However you should always make a decision of whether your doing it for the money or are your earning money for something you love doing and get a kick out of it.
Never loose sight of the business need and what your there for. Customer is king.