Hi everyone. I added a plan guide.
DECLARE @stmt nvarchar(max);
DECLARE @params nvarchar(max);
EXEC sp_get_query_template
N'SELECT * FROM dbo.REFER WHERE USERID = 619 AND MSGID = 104',
@stmt OUTPUT,
@params OUTPUT;
EXEC sp_create_plan_guide
N'TemplateGuide1',
@stmt,
N'TEMPLATE',
NULL,
N'OPTION(PARAMETERIZATION FORCED)';
Within seconds there were thousands and thousands of executions using the parameterized query plan instead of thousands of single use adhoc plan stubs for the same query.
I don't know if it is a performance increase or not. Hope so!