• There is a function called object_definition() that accepts object_id and then returns the T-SQL of object like stored procedures, UDF, or views. When combined with sp_msforeachdb, you can leverage it to quickly scan across all objects in all databases.

    exec sp_msforeachdb

    '

    print ''?'';

    use ?;

    select db_name(), type, name as object_name

    , object_definition(object_id) as object_text

    from sys.objects as o

    where is_ms_shipped = 0

    and (object_definition(object_id) like ''%PersonAudit%'')

    ';

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho