Skip to main content
1 of 2
Hannah Vernon
  • 70.5k
  • 22
  • 177
  • 321

For SQL Server 2008 R2 or earlier, I'd recommend running a SQL Server Profiler session against the server.

On the General tab, in the template dropdown, select "Blank", then on the Events Selection tab, choose "SQL_StmtStarting" from the list of events. Click the "Column Filters" button, and fill it out similar to this:

enter image description here

When you run this profiler session, the results will only show you rows where the TextData column contains the text you entered.

On SQL Server 2012 and above, I'd recommend using Extended Events to do this, however that is out of the scope of this question.

Hannah Vernon
  • 70.5k
  • 22
  • 177
  • 321