Here's a great CFMX function using the coldfusion.server.ServiceFactory class to get at the debugging information and extract just the generated SQL for a specific query.
This can be useful for logging or debugging. It renders the SQL so it can be copied into query analyzer (for example). The only thing to watch out for is the use of <cfqueryparam> in your SQL. When this tag is used (and it should be used a lot) it causes the rendered SQL to have placeholders (question marks) in the place of actual values - with the values listed below. This means it has to be edited when it's ported to query analyzer.
One limitation that I can't seem to overcome is that you can't use the function on 2 separate queries in the same page. So I can't do: <cfoutput> #queryGetSQL('query1')# ---- #queryGetSQL('Query2')# </cfoutput>. The second call to the function doesn't throw an error or anything - it just doesn't return anything.