SELECT A.AssociationID, 
		  A.AssociationName, 
		  A.RegionID,
		  R.ProvinceID
		  FROM Verified.Associations  A	
		  INNER JOIN Md.Regions R ON A.RegionID = R.RegionID	
		  LEFT JOIN Security.Users U ON U.UserID = @Afx_LoggedInUserID
		  LEFT JOIN MD.OfficeLocationSetup OLS ON OLS.OfficeLocationID = U.OfficeLocationID
		  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  
		  AND R.ProvinceID = OLS.ProvinceID
		  ORDER BY AssociationName ASC