Most likely, it depends on the ROM you are flashing. There are files that have root embedded in them, and some preserve user data, but chances are, the one you have will erase everything.
I was talking about the stock TouchWiz ROM that Samsung distributes. I want to root, but am worried I will not be able to get it back to stock conditions if I ever need/want to. That includes the binary counter, the ROM, and the stock recovery.