text: ﻿
  CREATE PROCEDURE [tSQLt].[Private_MarkSchemaAsTestClass]
    @QuotedClassName NVARCHAR(MAX)
  AS
  BEGIN
    SET NOCOUNT ON;
  
    DECLARE @UnquotedClassName NVARCHAR(MAX);
  
    SELECT @UnquotedClassName = name
      FROM sys.schemas
     WHERE QUOTENAME(name) = @QuotedClassName;
  
    EXEC sp_addextendedproperty @name = N'tSQLt.TestClass', 
                                @value = 1,
                                @level0type = 'SCHEMA',
                                @level0name = @UnquotedClassName;
  
    INSERT INTO tSQLt.Private_NewTestClassList(ClassName)
    SELECT @UnquotedClassName
     WHERE NOT EXISTS
               (
                 SELECT * 
                   FROM tSQLt.Private_NewTestClassList AS NTC
                   WITH(UPDLOCK,ROWLOCK,HOLDLOCK)
                  WHERE NTC.ClassName = @UnquotedClassName
               );
  END;