Well, without specifying what DB you are using its kind of tough to say.
I will assume SQL Server, but all major DBMS'es should have a way
to get at this.
In SQL Server There are a number of ways you can do this.
1) Select the appropariate rows from syscomments ...look up they system
tables in SQL Server Books on Line for more info. Probably a join
between sysobjects and syscomments.
2) Use a sql system stored procedure
sp_helptext MyStoredProcedureName
3) Use the INFORMATION_SCHEMA views that SQL Provides. These views are
part of the SQL-92 standard so are probably the most generic way to go
about it.
SELECT ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.Routines
WHERE ROUTINE_Name = 'TheStoredProcIWantToFind'
Hope that helps,
-eric