IF TYPE_ID(N'NB_GetMyChannels_MyGroups') IS NULL
BEGIN
	CREATE TYPE NB_GetMyChannels_MyGroups AS TABLE(
		Groups_PrincipalID [int] NULL
	)
END

IF OBJECT_ID(N'NB_GetMyChannels') IS NOT NULL
BEGIN
	DROP FUNCTION NB_GetMyChannels
END