We see the same afternoon play out in shop after shop. Somebody drops a column that nothing references. The procedures were checked, the views were checked, the change was approved. Then an application starts throwing errors, because it had been building that query in its own code all along. Anyone who thinks to search the plan cache for a string usually thinks of it about a day late.
How do I search the plan cache for a string to find out what still uses a column in SQL Server? To search the plan cache for a string, look through the text of cached statements for the table, column, or hint, then repeat the search in the Query Store of every database. Stored object definitions alone miss ad hoc and prepared statements from applications. Rank the matches by cost and check when each last ran.
Why a clean definition search misleads you
The first move is almost always to search object definitions. It is quick and it feels thorough. In Database Health Monitor that job belongs to Schema Search, and it does it for the code stored in your databases.
The trouble is what an empty result seems to say. It reads as nothing uses this. What it really says is that no stored object mentions it. Ad hoc and prepared statements sent by applications never become objects, so no amount of searching definitions will turn them up. An ORM, a reporting tool, a script on a forgotten server: all of them can depend on your column and leave no trace in a procedure.
The cost lands on the business. An outage, a rollback under pressure, a restore if the data went with the column. Or the quieter version, where nobody dares remove anything and the schema silts up for years.
Ask what runs, not what is stored
The better question is what actually executes against the thing you are about to change. The server keeps two records of that. The plan cache holds statements it has compiled and still remembers. Query Store, on SQL Server 2016 or later and where it is turned on, keeps query text per database.
Neither is complete alone. A cache flush or memory pressure can empty one, while Query Store may be off in exactly the database you care about. Searching both, across every database on the instance, gets you far closer to the truth than either.
You can script this yourself. It gets fiddly. Brackets and underscores mean something to LIKE, so a pasted two-part name can match the wrong things. One ad hoc statement can appear hundreds of times with different literals. And you have to visit each database's Query Store in turn, then reconcile that with what the cache said.
How to search the plan cache for a string without the scripting
The Workload Text Search report does that work from one box. Right-click the server, open Instance Level Reports, and choose Workload Text Search. Type at least three characters and press Enter.
Workload Text Search is one of the reports in Database Health Monitor. It runs against your own servers, and it takes about a minute to have this same screen open on one of them.
You choose how strict the match is. Whole word is the one we would reach for with table names: Orders finds [dbo].[Orders] but leaves OrdersArchive alone. Contains treats brackets, percent signs and underscores as plain text. There are also Starts with and Regular expression options. A regular expression with an alternation, or with no literal opening, makes the server hand back every cached statement for your workstation to filter, and the page tells you when that happens.
The Plan XML box is off by default because it reads every plan. Turn it on when the thing you are hunting only shows up in a plan, such as an index name or a statistic name. Those hits ignore case and match as contains, whatever you picked above.
Reading what comes back
A summary line sits over the grid. It might report 23 statements, 4 from procedures or functions and 19 ad hoc, spread over 3 databases. In that example the definition search could only ever have pointed at a small part of the story.
Read the line under it too. Databases skipped in the Query Store pass are named with a reason: Query Store off, not online, no access for this login, or not readable. We treat that list as part of the answer. Zero matches with three databases unsearched is not a green light.
| Column | The decision it helps with |
|---|---|
| Lives In | Whether you are fixing a procedure or chasing an application sending ad hoc or prepared SQL |
| per Day | Which caller costs the most, in CPU, reads or elapsed time |
| Executions per Day | How busy the caller is |
| Last Run | Whether this is live traffic or something old |
| Copies | How many distinct plans were folded into the row |
| Source | Whether the evidence came from the plan cache, Query Store or both |
Rows are grouped by query_hash, so literal variants of one statement do not bury everything else. Where a statement turns up in both sources, the rate shown is the larger of the two. They are never added together, since both are counting the same executions.
Select a row and the statement appears in a pane with each match highlighted. If your term was in the batch but outside that statement, a comment tag for instance, you see the whole batch.
What to do with the list
For a drop or a rename, work from the top. Procedures go to whoever owns the database code. Ad hoc and prepared rows go to the application teams, and Copy all matching statements gives you a script to send them, each statement under a comment saying where it lives. The right-click menu can also pass your term to Schema Search, so stored and running code both get covered.
The same box answers other questions. Search NOLOCK or OPTION (MAXDOP 1) to see every statement carrying that hint. Search a linked server name before you retire it. Search an application's comment tag, such as /* OrderService */, to see what that service runs. Because results are ranked by cost, each of these arrives as a work queue.
Know the edges. A statement that has left both the cache and Query Store will not be found, and neither will anything sitting only in application source or an Extended Events capture. Each pass is also capped: 5,000 of the costliest cache matches and 1,000 per Query Store database, with a notice if results were cut short. A month-end job can easily hide from a search run mid-month if nothing retained it.
After the change ships, keep watching. Our post Who Changed the Schema, and Did Waits Get Worse? picks up from that side. The full list of controls and permissions is in the Workload Text Search documentation. And if the list that comes back is longer than your team can safely untangle, that is a good time to bring in a second pair of eyes.
What to check on your own server
- Confirm your login has VIEW SERVER STATE, or VIEW SERVER PERFORMANCE STATE on SQL Server 2022 and later
- Check which databases have Query Store turned off or are offline, and note them as blind spots
- Search both cached statement text and Query Store text for the object name before you drop or rename it
- Compare the last execution time and daily cost of each match to decide which callers need fixing first
- Search application source code separately, since a statement that has aged out of the server will not appear
Try Database Health Monitor Today
Stop guessing what still runs against a table, column, or procedure before you change it and find out the hard way. Database Health Monitor shows it on every instance you connect, in the time it takes to open the report.
Download Database Health Monitor and run the Workload Text Search report against your own server. There is nothing to configure first, and you will know inside a few minutes whether it tells you something you did not already know.

