Script out objects that depend on in SQL Server I have a requirement wherein I need to script out the definition of all objects that depend on a single table. See the below example.  



Let's say I have a table and there are 15 objects(views, SPs, Functions, triggers etc) that depend on it. Then I need definition of all those 15 objects.

This needs to be done on 15 servers. Is there a way to script all those objects using a T-SQL script? Currently I am noting all the objects down in an excel and scripting out definitions of all the objects manually which is very tedious. :(
In SSMS...


Rt Click on the Database in question, navigate to Tasks and then Generate Scripts...
Select Choose Objects on the left and then click the radio button to Select specific database objects
Select the object you wish to script
In Save to file click the Advanced button
6th option down, set Generate Script for Dependent Objects to true
Set any other options you want and click the OK button
Set the File name and path or Save to Clipboard or Save to new query window
Click the Next buttons to finish.