Script Download:
The script is available for download from https://gallery.technet.microsoft.com/scriptcenter/How-to-create-a-plan-guide-28cca76c.
The sample code demonstrates how to create a plan guide for SQL or PROC in a database.
You can find more All-In-One Script Framework script samples at http://aka.ms/onescriptingallery