<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Stored Procedures on SQL Server Scripts</title><link>https://www.sqlserver70.com/tags/stored-procedures/</link><description>Recent content in Stored Procedures on SQL Server Scripts</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>SQLServer70.com</copyright><lastBuildDate>Thu, 09 Apr 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://www.sqlserver70.com/tags/stored-procedures/index.xml" rel="self" type="application/rss+xml"/><item><title>SQL Server Search Stored Procedure and View Text</title><link>https://www.sqlserver70.com/post/sql-server-search-stored-procedure-view-text/</link><pubDate>Thu, 09 Apr 2026 00:00:00 +0000</pubDate><guid>https://www.sqlserver70.com/post/sql-server-search-stored-procedure-view-text/</guid><description>
&lt;h2 id="search-stored-procedure-and-view-definitions-in-sql-server"&gt;Search Stored Procedure and View Definitions in SQL Server&lt;/h2&gt;
&lt;p&gt;This script searches the text of stored procedures, views, functions, and triggers in the current database using &lt;code&gt;sys.sql_modules&lt;/code&gt;, returning any programmable object whose name or definition contains a given keyword.&lt;/p&gt;
&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1012089347386563"
crossorigin="anonymous"&gt;&lt;/script&gt;
&lt;ins class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-1012089347386563"
data-ad-slot="8593449130"&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;h2 id="purpose-and-overview"&gt;Purpose and Overview&lt;/h2&gt;
&lt;p&gt;Finding which stored procedures, views, or functions reference a specific table, column, or keyword is a routine DBA and developer task. It comes up when renaming a column, tracking down where a piece of business logic lives, auditing who calls a particular table, or investigating the impact of a schema change. SQL Server stores the source definition of every programmable object in &lt;code&gt;sys.sql_modules&lt;/code&gt;, making it straightforward to search across all object types in a single query. This script, adapted from the sqlserver-kit community collection by Ed Pollack and Konstantin Taranov, queries &lt;code&gt;sys.sql_modules&lt;/code&gt; joined to &lt;code&gt;sys.objects&lt;/code&gt; to search both object names and their full definitions, returning results with the object type, schema, and full source text.&lt;/p&gt;</description></item></channel></rss>