I'm studying about ad hoc statement performance, and it seems everything is moving around the type of statement "safe", respectively "unsafe" with a sable/unstable plan.
Simply said, how can I know the statement is deemed as "unsafe", but it has a "stable" plan.
I think the answer is around dm_exec_query_plan
and dm_exec_query_stats
, but it is not very clear to me.