How to Change Compatibility Level in SQL Server

Best Practice is to Change the database to Single User Mode, Change the compatibility Level and Change the database to Multi User Mode. Otherwise all the current session will be use previous compatibility mode until the session are reconnect.

Change the compatibility Mode using T-SQL:

USE [master] GOALTER DATABASE [Demo] SET COMPATIBILITY_LEVEL = 150

GO