Kendra Little has a few Github gists showing how to configure the blocked process report:
I wanted a friendly way to share code to configure and manage the Blocked Process Report, so I’ve created a gist on GitHub sharing TSQL that:
-
Enables the Blocked Process Report (BPR)
-
Collects the BPR with an Extended Events trace
-
Collects the BPR using a Server Side SQL Trace (in case you don’t care XEvents or are running an older version of SQL Server)
-
Lists out the Extended Events and SQL Traces you have running, and gives you code to stop and delete traces if you wish
Click through for the code.