Using Dynamic Queries in Stored Procedures

http://www.4guysfromrolla.com/webtech/sqlguru/q120899-2.shtml

Beginning with SQL 7.0, there is a handy little proc called sp_executeSQL that will accept parameterized queries. It will also attempt to re-use query plans, so if you execute the same statement multiple times, chances are you'll get a reused query plan.

Source: 4GuysFromRolla.com
Viewed 5073 times