SELECT A.AssociationID, A.AssociationName, A.RegionID,R.ProvinceID  FROM Verified.Associations  A	INNER JOIN Md.Regions R ON A.RegionID = R.RegionID	WHERE  (CASE WHEN ISNULL(@SearchText, '') <> '' THEN          CASE                 WHEN AssociationName LIKE '%' + @SearchText + '%' THEN 1                 WHEN RegistrationNumber LIKE '%' + @SearchText + '%' THEN 1                WHEN BusRegNumber LIKE '%' + @SearchText + '%' THEN 1                ELSE 0         END         ELSE 1  END) = 1 AND   (CASE WHEN ISNULL(@AssociationID, '') <> '' THEN   CASE WHEN AssociationID = @AssociationID THEN 1 ELSE 0 END   ELSE 1   END) = 1  ORDER BY AssociationName ASC