• Try this one:

    DECLARE @a nvarchar(max)

    SELECT @a = ISNULL(@A,'') + OBJECT_DEFINITION(object_id) + '

    GO

    ' FROM sys.procedures

    SELECT CAST(@A AS XML)

    Explanation:

    1. Use OBJECT_DEFINITION to get the full script of the object in nvarchar(max)

    2. Use the per row assignment to @a to add each object_definition to the variable.

    3. Cast the result to XML and switch to Grid Mode, to avoid the result being cut off at x chars.

    Best Regards,

    Chris Büttner