We have an application that runs queries via sp_executesql. I have run a profiler trace and now I want to run T-SQL queries to create query templates and aggregate the data to determine run times and execution counts for each query template. Does anyone have a SQL scirpt to parse through queries using sp_executesql to produce query templates? I tried the dbo.SQLSig and dbo.fn_SQLSigTSQL functions but they did not parse the queries correctly.