I need to search a SQL server 2008 for stored procedures containing where maybe the name of a database field or variable name.
First ensure that you're running the query under your user credentials, and also in the right database context.
USE YOUR_DATABASE_NAME;
Otherwise, sys.procedures won't return anything. Now run the query as below:
select * from sys.procedures p
join sys.syscomments s on p.object_id = s.id
where text like '%YOUR_TEXT%';
Another option is to use INFORMATION_SCHEMA.ROUTINES.ROUTINE_DEFINITION, but be aware that it only holds limited number of characters (i.e., first 4000 characters) of the routine.
select * from YOUR_DATABASE_NAME.INFORMATION_SCHEMA.ROUTINES
where ROUTINE_DEFINITION like '%YOUR_TEXT%';
I tested on Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (X64)