In earlier version when we have to clear cache for any database we had access to DBCC command which we could run to clear the cache for a particular plan or for the server.
Here is the script which you can run on SQL Server 2016 and earlier versions:
In SQL Server 2017 we now have a new script which we can run at the database level to clear the cache for that particular database. This is indeed a blessing for many when you just want to clear the cache for the database and not for the entire server, you can run the following script.
ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE;
Well, I am going to use this new script for all of my future engagements. Let me know if you have started to use the new script when you are busy with SQL Server performance tuning.
In any case, do not clear the cache of the production server, without consulting your manager who must know how CACHE works.
Reference: Pinal Dave (https://blog.sqlauthority.com)