Prevent Object Create in Master Database in SQL Server
USE master
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER DDL_PreventObjectCreationInMasterDB
ON DATABASE
FOR CREATE_TABLE, CREATE_VIEW, CREATE_PROCEDURE,CREATE_FUNCTION
AS
BEGIN
-- SET NOCOUNT ON to prevent extra result sets from interfering with SELECT statements.
SET NOCOUNT ON;
PRINT 'Creation of user objects in master database is not permitted'
ROLLBACK
END
GO