Programatically scan a stored procedures parameters
Ok, after much digging into this I have determined this is not often possible. I will detail the following scenarios that break down the ability to get the original parameters from the execution plan.


If the parameter is not used in a where clause. Scenarios:


The parameter is placed into a local variable as a way to work around parameter sniffing
The parameter is used in a calculation in a local variable

If the parameter is used in a where clause but a function is used upon it
If the parameter is used in multiple sql statements in the stored proc it will appear in multiple parameter lists. 


I just wanted a list of all of the original parameters passed into the stored proc and their values from the original plan creation so that I could recreate the call if need be. I know that I could obtain this information using extended events or profiler but I was trying to extract it from the query plans.