Get Stored Procedure Definition– DAC wayPosted: January 14, 2016
By connection the instance with DAC (Dedicated Administrator Connection), we can use the following code snippet to get stored procedure definition.
To connect to a server using the DAC:
In SQL Server Management Studio, File>>>New>> click Database Engine Query.
type ADMIN: in front of your instance name.
---DAC connection select p.name, cast(sov.imageval as varchar(MAX)) sp_def, len(cast(sov.imageval as varchar(MAX))) from sys.procedures p inner join sys.sysobjvalues sov on p.object_id = sov.objid WHERE cast(sov.imageval as varchar(MAX)) like '%searchString%' --http://improve.dk/where-does-sql-server-store-the-source-for-stored-procedures/