I agree with Mike, but it's also perfectly OK to say "What was it before?" This is probably what I would say, personally, but it's slightly more formal than "What did it used to be?"
"What was it formerly?" is too formal. It's grammatically correct, but it sounds stiff.