Dynamically generated code T-SQL code can cause trouble
A poorly written query can code trouble if the SQL server cannot predict a good execution plan because of too many type conversation and varchar max parameters:
SQL Server CPU usageDynamically generated T-SQL code