Using Capture Mode
SMO programs can capture and record the equivalent Transact-SQL statements issued by the program in place of, or in addition to, the statements that are executed by the program. You enable capture mode by using the ServerConnection object, or by using the ConnectionContext property of the Server object.
See Also
Tasks
How to: Enable Capture Mode in Visual Basic .NET