sp_configure set at code execution - Pro/con's of turning on/off The right answer of course is 'it depends', but on the surface it seems to make sense to turn on/off some options when needed as the code sample below for Ole Automation Procedures would do. Could also be xp_cmdshell or Ad Hoc Distributed Queries among a handful of others. EDIT: The question - is this a good or bad idea? why/why not

sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ole Automation Procedures', 1;
GO
RECONFIGURE;
GO

--Sample Code:
Declare @Object as Int;
Declare @ResponseText as Varchar(8000);
 Exec sp_OACreate 'MSXML2.XMLHTTP', @Object OUT;
Exec sp_OAMethod @Object, 'open', NULL, 'get', '&lt;URL&gt;&amp;output=XML','false'
Exec sp_OAMethod @Object, 'send'
Exec sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT

Select CONVERT(xml,@ResponseText)

Exec sp_OADestroy @Object;

GO
sp_configure 'Ole Automation Procedures', 0;
GO
RECONFIGURE;
GO
A) Those options can only be switch by logins with elevated permissions. Therefore to alter them at run-time the application must run with elevated permissions. This is a security risk.

B) Actions performed in this way run in the DBMS's process. Any instability (bug, exception) they cause will affect the stability of SQL Server and all clients it is serving.