This story is attributed to Mary Ludwig Hays McCauley, the real-life woman most often associated with the title Molly Pitcher. Of course, the historical details aren't entirely clear and there's been lots of conflation and embellishment, but here are the details on the real Molly Pitcher. In 1777, her husband (she married at the age of 15 or 16) enlisted in the army and she followed him in his training and fighting. (Her husband had been a barber prior to enlistment, and this was not a profession she could take over.)
In 1778, her husband, having been trained in the artillery in Washington's army, was on the front lines of the Battle of Monmouth. Mary served as she normally did: bringing water for the soldiers and the cannon. At some point, her husband was unable to continue working the cannon (he was either wounded or collapsed from heat -- the battle was in June). Mary took over his duties.
There are several wonderful and perhaps apocryphal stories about her time on the battlefield. One is that as she stood before the cannon, swabbing the barrel out, a shot from the British blasted across and flew through her legs, tearing her petticoats as it passed. She continued in her role despite this close call. A second is that her service was recognized by George Washington, who noticed her on the battlefield, inquired about her, and even gave her status as an honorary army member.
There is little to verify these two accounts, but one can understand why they would be told. The first gives the power to the idea that she was in battle -- not behind the lines. Too often, women were cast in supporting roles and thus get little credit. To claim that Molly Pitcher was involved in the war would be true, regardless of whether she worked the cannon or not: she was there, she served, she made a difference. But to get the glamour of the position, she had to be in danger and she had to do a man's job. (I find it amusing that the cannon ball went between her legs. This seems ridiculously suggestive to me. There is a diary entry from a soldier who claims to be an eyewitness to the event; even he recounts it in a humorous manner.) As to the second, there seems to be little concrete evidence of this happening, and (given the research I've done on Deborah Samson) such a resounding recognition seems unlikely to me. At the time, she was as likely to be condemned for taking on such an inappropriate role as extolled for it.
What is verifiable is the fact that Mary drew a pension for her service (after suffering, like Deborah, with a husband who made terrible financial decisions). In 1822, the state of Pennsylvania granted her a military pension. It is unclear whether she received this for her own service or as a widow of a veteran.
There are several paintings, engravings, and woodcuts of Molly Pitcher. These capture the essence of why she gets so much acclaim. In these depictions, she is shown in full female regalia: ruffled cap, petticoats, dress, and apron. Often, her fallen husband's body is by her feet. She has the tamper for the cannon in her hands and thrusts it down the cannon's barrel. Thus, she is both perfectly female in her appearance and perfectly male (literally and figuratively) in her behavior. Scandalous at the time, perhaps, but exciting (even titillating) afterwards.
Next - a closer comparison of Deborah and Molly/Mary.