CREATE FUNCTION IsCurrentDbVersion ( @currentVersion VARCHAR(10) ) RETURNS BIT BEGIN DECLARE @dbversion VARCHAR (10) SET @dbversion = CONVERT(VARCHAR(10), (SELECT VALUE FROM DatabaseVersion)) DECLARE @IsCurrent BIT = 0; IF (@currentVersion = @dbversion) SET @IsCurrent = 1 RETURN @IsCurrent END