As a temporary workaround, use Forced Parameterization. This is a workaround for applications that don't properly parameterize queries. It's better to use parameters for frequently-run queries, and hard-coded values where you want the plan to be based on individual value. Use the following statement to enable the workaround while you fix the queries or create stored proedure with parameters on the queries.
ALTER DATABASE [TestDB] SET PARAMETERIZATION FORCED
Please read this article on how to parameterize your queries.