We are getting the below message sometimes while executing the stored procedure, after that without any change deleting and re-executing the stored procedure it is working fine.
QUOTED_IDENTIFIER
is a "sticky" option so the setting in effect when the procedure was created is used at runtime. Since no procedure changes were made, the error suggests the stored procedure was created with QUOTED_IDENTIFIER OFF
and an index with one of the types mentioned in the error message was created/dropped.
Recreate or alter the stored procedure from a session with both QUOTED_IDENTIFIER ON
and ANSI_NULLS ON
to avoid the problem going forward.