I couldn’t find an easy way to search for a column across all tables in SQL Server 2008 like I could in 2003.
After some poking around on the internet I found the following on this blog:
Select O.name objectName, C.name ColumnName
from sys.columns C inner join sys.objects O ON C.object_id=O.object_id
where C.name like ‘%NameOfColumnHere%’ order by O.name,C.name
Note: Sometimes when you copy and paste the apostrophes get changed surrounding the name of the column you are looking for so you might need to delete them and put them back in.
Update:
The following is for finding stored procedures:
SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE ‘%NameOfStoredProcedureHere%’
AND ROUTINE_TYPE=’procedure’