xml input to a SP results in a useless Plan

mauripop 2017-10-10 00:15:12

A developer is using xml to inpput several parameters into this SP. The result is a Plan that only estimates one row will be returned on every statement, when the Actual Execution Plan returns many thousands on some statements in here.

What can I do to have SQL server build a better plan for this? Optimize for unknown trace flag?

I can't ask him to stop using XML input.

I enclose the Plan Explorer saved file, I couldn't sent it from Plan Explorer though, that failed.