SQL Script are stored in syscomments table you can join the syscomments with sys.objects on Object_ID and ID in syscomments. To get the script against each proc or function or views.
select
Object_ID,TEXT
from
Sys.Objects Obj
Join SysComments comm On Obj.Object_id=comm.Id
note, you can have multiple line of Text against an ID if the script is too long.