Not since the nights of screaming during infancy has such an ear-splitting sound come from your child. Unlike a kindergartner, most 2-year-olds don't fully understand what whining means, they just do it because, so far, it's worked. Stopping the shrill sound means defining the behavior and nipping it in the bud.
Record the whining. Yes, tots this age are skilled at pushing your buttons, but they don't necessarily understand how they're doing it, and they can't stop if you don't clarify the issue. The next time your 2-year-old starts whining, if possible, discretely videotape her with your camera phone. You don't want her to see you recording the scene, or her frustration and outrage will intensify.
Explain to your toddler, when she's calm, that you are happy to listen when she asks for something nicely. Also mention that asking nicely does not necessarily mean she'll always get what she wants, but whining will cause you to immediately stop listening. Demonstrate how to ask nicely and then have her try out her newly discovered nice voice for a camera-phone video.
Replay the whining voice and the nice voice so your toddler can see the difference, and ask her which one she thinks sounds better. If she still doesn't get it, ask her to do something, like eat her vegetables, but in an ultra whiny voice of your own. Hearing an adult whine often puts in perspective how ridiculous the voice sounds. If she still doesn't get it, 2-year-olds have a notoriously unpredictable sense of humor, and she might just laugh at the entire demonstration. You'll have to wait until the next whining episode to give your words meaning.
Nip whining in the bud the next time it starts. "Mommyyyyy, I want some icceeeee creeee-!" Kneel down to your child's eye level immediately and firmly tell her, "Stop. That's your whining voice, and I won't listen to it. I will listen when you ask in a nice voice." Then return to your task and wait for a pleasant request. Note that whining rarely occurs when your child has your full attention, so expect to interrupt a few phone conversations or emails to correct her behavior.
Send her to another room if she continues whining, even after you've explained the nice voice requirement. Warning: Denying her request will escalate the whining, at least initially. Because a nice voice didn't get her what she wanted, she'll naturally attempt her former method -- whining until she wins. Your job, as a loving parent, is to give her the tools to politely request what she needs, and sometimes graciously accept denial.