I want to loop through several stored procs and extract one string form each of them to use in another procedure (basically the 4-part remote server string)
So I can
You can use the system stored procedure sp_helptext to get the stored procedure definition into a table and then just query against that temp table / table variable something like this..
DECLARE @TABLE TABLE
(Line_Number INT IDENTITY(1,1), Text_Column NVARCHAR(MAX));
INSERT INTO @TABLE(Text_Column)
EXECUTE sp_helptext Your_Proc_Name
SELECT *
FROM @TABLE
WHERE Text_Column LIKE '%BOCTEST%'
UPDATE
SELECT p.name
,m.[definition]
FROM sys.procedures p
INNER JOIN sys.sql_modules m
ON P.[object_id] = m.[object_id]
WHERE m.[definition] LIKE '%BOCTEST%'