command to clear cache in sql server code example
Example: clear query cache sql server
DBCC FREEPROCCACHE
DBCC DROPCLEANBUFFERS
DBCC DROPCLEANBUFFERS clears clean (unmodified) pages from the buffer pool
Precede that with a CHECKPOINT to flush any dirty pages to disk first
DBCC FLUSHPROCINDB clears execution plans for that database