Find stored procedure by name Find stored procedure by name sql sql

Find stored procedure by name


You can use:

select * from    sys.procedures where    name like '%name_of_proc%'

if you need the code you can look in the syscomments table

select text from     syscomments c    inner join sys.procedures p on p.object_id = c.object_idwhere     p.name like '%name_of_proc%'

Edit Update:

you can can also use the ansi standard version

SELECT * FROM     INFORMATION_SCHEMA.ROUTINES WHERE     ROUTINE_NAME LIKE '%name_of_proc%'


Assuming you're in the Object Explorer Details (F7) showing the list of Stored Procedures, click the Filters button and enter the name (or partial name).

alt text


This will work for tables and views (among other things) as well, not just sprocs:

SELECT    '[' + s.name + '].[' + o.Name + ']',    o.type_descFROM    sys.objects o    JOIN sys.schemas s ON s.schema_id = o.schema_idWHERE    o.name = 'CreateAllTheThings' -- if you are certain of the exact name    OR o.name LIKE '%CreateAllThe%' -- if you are not so certain

It also gives you the schema name which will be useful in any non-trivial database (e.g. one where you need a query to find a stored procedure by name).