What I've done in a similar situation was to move ALL of the SQL out of the app and into a DB-abstraction module. The app just calls (for instance) a "get me a client record" routine, and the abstraction module handles all the database jiggery-pokery.
It's (I think) a good first step toward the SQL phrasebook stuff you're looking at. And (as in my case) you may find that you don't need to take it any further. The big bonus is that maintenance is *way* easier than what you started with....
Just my $0.02CDN
WARNING: You are logged into reality as root.