From SpongePedia, the First SpongeBob Wiki.
The Curse of the Hex is an episode from season 7.
When the Krusty Krab closes for the night, an old hag comes in to order food anyway to Squidward's dismay. She asks for a Krabby Patty, but she doesn't have any money and only has a pocket of shells. She begs back and forth for the Krabby Patty from Mr. Krabs and Squidward until SpongeBob tells her something and she leaves angrily. That night, SpongeBob claims to be locking up for home, but in reality he goes behind the Krusty Krab with two Krabby Patties, to the Hag hiding behind the dumpster. SpongeBob attempts to give her the Krabby Patties, but Mr. Krabs finds out and comes for the patties, before she can take them. Mr. Krabs then takes back the patties, and the furious Hag curses the Krusty Krab. The next morning, despite Mr. Krabs trying to claim there is no such thing as curses, no customers come to the Krusty Krab and eventually when attempting to cook Krabby Patties, fire is set to the building and burns up Mr. Krabs' money leaving Mr. Krabs to think the curse is real. SpongeBob and Mr. Krabs then go to the Hag's lair where she refuses to lift the curse until Mr. Krabs uses a method of begging. She agrees to lift the curse only if they accomplish a quest to steal a gold coin from a golden eel. They successfully take the coin from the eel in its lair and give it to the Hag where she uses the coin to clean her laundry. They go back to the Krusty Krab, where it turns out she really didn't curse the Krusty Krab but instead put a CLOSED sign in front of it claiming that she wouldn't waste a good spell on a person like Mr. Krabs. Immediately when removing the sign, the Krusty Krab's parking lot fills with customers. However, just when Mr. Krabs thinks that everything is back to normal, the golden eel suddenly appears at the Krusty Krab.