Eitan Blumin has a script for us:
Running the above script with the parameter @RCA set to 0 will output a list of the top query hashes (sorted based on their size in bytes so that you’d see the most impactful queries first) that have multiple different query plan hashes cached for them.
Running the script with the parameter @RCA set to 1 will output the same list, with additional columns that will help you do deeper root cause analysis.
Unlike the similar script provided by Brent, my script counts the number of query plan hashes rather than the query plan handles per each query hash. I found that this results in far fewer “false positives”. But you can still set the parameter @CountByPlanHandleInsteadOfPlanHash to 1 if you want it to count based on query plan handles instead.
Click through for the script, details on how it works, and various classes of reason why you might get to this outcome.