Use DBCC to Clear the Process Cache

Fixes SQL Server error 7359 when running a distributed query against a linked server

More info See: http://support.microsoft.com/kb/2588970

Run these statements against the database that is causing the issue.

To see all compiled plans that are cached, use the following:

SELECT *

FROM sys.dm_exec_cached_plans

Use the following query to find the plan_handle needing to be cleared

SELECT plan_handle, st.text

FROM sys.dm_exec_cached_plans

CROSS APPLY sys.dm_exec_sql_text(plan_handle) AS st

WHERE text LIKE N'%<search string here>%';

You should see someting like the results below::

-----------------------------------------------------

plan_handle text

0x05000B00239B2C1840214698010000000000000000000000 create view vwDEVIN_GoldmineContactTable2 as select * from <search string here>

0x05000B00EA763817404133D6000000000000000000000000 create view vwDEVIN_GoldmineContactTable as select * from <search string here>

0x05000B00239B2C1840216296000000000000000000000000 create view <search string here> as select * from CONTACT1

Use the appropriate plan_handle along with DBCC and FREEPROCCACHE to clear the plan from the cache as below:

DBCC FREEPROCCACHE(0x05000B00239B2C1840214698010000000000000000000000);

GO