--pretend this table contains all the states.
declare @states table (identifier varchar(2))
insert into @states
select 'MI' UNION
select 'CO' UNION
--this simulate states selected in the application
declare @selectedStates table (identifier varchar(2))
--insert a state to simulate the user selecting a state.
insert into @selectedStates
--comment this line to see @allStates flip
select 'MI' --comment this line to see @allStates flip
declare @allStates bit
--if the user hasn't selected a state get all the results.
if ((select count(*) from @selectedStates) = 0)
select @allStates = 1
--give back the results:
select identifier from @states
where (identifier in (select identifier from @selectedStates) OR @allStates = 1) AND 1=1 --additional filters could go here instead of 1=1