Residency Status Question

Hello, I have a question about residency. I am originally from Alabama and have been a resident of the State until I graduated college. I took my first job in Maryland and worked over year had had to declare residency in Maryland, but I have decided to go back to school for a Masters in New York. I have no ties to Maryland and lived in an apartment while there. My question is can I switch my residency back to Alabama. I thought I would have been in Maryland longer hence why I changed, but life takes turns and now I am off to New York. The only ties to Alabama is my family and a home I know I can have important documents mailed to, but I know I can't do that with my Maryland address. I hope that makes sense.