Ouch - you certainly don't need a cursor to count the number of records matching a filter in a table. A filtered count should be able to replace the whole cursor:
declare @state_count as int = 0;
select @state_count = COUNT(numaddress_state)
from customer
where customer_state_check = @state;