I have recently seen a character in a comic who used pies as an improvised weapon in order to deal damage. Is this actually possible to do?
You're going to have to ask your DM, but don't be surprised if you get pie in your face.
includes any object you can wield in one or two hands, such as broken glass, a table leg, a frying pan, a wagon wheel, or a dead goblin.
While a pie absolutely falls in that category, it is well within a DM's purview to say they have no idea how this would actually hurt someone and tell you that you can't use it as such. A DM could logically state that not every object can deliver meaningful damage.
For those interested, a brief history on Pieing.
Yes; The Improvised Weapon rules cover this
In the Player's Handbook, Chapter 5, Section Weapons, under the header "Improvised Weapons", the following rule is given to improvised weapons which do not otherwise resemble a regular weapon (according to the DM's whims):
An object that bears no resemblance to a weapon deals 1d4 damage (the DM assigns a damage type appropriate to the object). If a character uses a ranged weapon to make a melee attack, or throws a melee weapon that does not have the thrown property, it also deals 1d4 damage. An improvised thrown weapon has a normal range of 20 feet and a long range of 60 feet.
In this case, a pie being thrown at an opponent would have a damage dice of 1d4 (+the Strength modifier of the thrower) and have a range of 20 feet, or 60 feet with Disadvantage on the Attack Roll.
As DM, I'd probably put a negative modifier of 1 or 2 on the damage of the pie (the pie itself would probably cushion some of the blow), but that's up to DM fiat and not something inherent to the rules.