David.Poole (8/31/2010)
Why not use sp_ExecuteSQL and build up the query that is needed in T-SQL code. This will cache the execution plan for the query statement.The other thing I would suggest is that if you are going to using multiple LIKE '%[some string]% then you consider using full text indexes.
Unfortunately Full Text Indexing doesn't handle middle of a string search like LIKE does.
It seems to only handle the LIKE 'sometext%' type searches... and not inner text type searches.
Or at least that's what it did in SQL 2005 and earlier.