Create a Transact-SQL Script for Running a Trace (SQL Server Profiler)
Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).
This topic describes how to create a Transact-SQL script from an existing trace file or table by using SQL Server Profiler.
To create a Transact-SQL script to run a trace
On theFilemenu, point to Export, point to Script Trace Definition, and then click the version that corresponds to the server you want to trace.
In the Save As dialog box, enter a name for the script file, and then click Save.