A restraining order is a court order form that is issued toward an individual, forbidding them from getting close to a person. It appears in the episode "Restraining SpongeBob."
Role in episode
Squidward, after getting tired of SpongeBob bothering him at the Krusty Krab, issues him a restraining order. SpongeBob is not allowed to get within 15 feet of Squidward until the restraining order is lifted. Squidward is pleased by this, but SpongeBob has difficulty handing out orders to Squidward due to the restraining order.
However, Mr. Krabs then hires Patrick to take out the orders. Unfortunately for him, Squidward finds Patrick even more annoying than SpongeBob, so at the end of the episode, he changes the restraining order to make it so that Patrick trades places with SpongeBob. And then it is unknown what happens to it after the order expires sometime after the episode.