Sergey's answer is correct, however you need to be careful with the performance impact of using dynamic SQL.
I'd seriously look into creating a set of stored procedures and then having a master one that calls the correct sub-procedure depending on a condition.
Usually when you think about it a bit there isn't a need for this macro-substitution variant in SQL.
If you'd like to post up some code I'd gladly take a look.
Simon