I run into the classic Parameter Sniffing issues in SQL Server 2012. Based on some research I found multiple options around this problem. The two options that I need to unde
Will OPTION(OPTIMIZE FOR UNKNOWN) reuse cache instead of recompiling each time?
Yes. Optimize for unknown will influence how the plan is generated (i.e. explicitly prevent it from sniffing parameters and compare it with column data histogram), but once generated the plan stays in cache and is reused.
OPTION(RECOMPILE)
will force a recompile on every execution and is a rather heavy handed approach. It makes sense only in an analytical DW/BI environments where each query may be different, complex and probably with a significant run time.
You also have other options at your disposal:
Both of these allow you to obtain the same effect as in your post, but in a non-invasive way (no app code/query changes).