Then the problem does not lie with the game, but with the way *you* see the game.
"Derailing" is the best thing that can happen to every story. It means the players have managed to get some control over the story, and they can finally express the kind of game *they* want to play. That's when you start giving it to them, waiting for their reactions and upping the ante at every turn.
Improvisation is the key to a great RPG story, always. You can spend *hours* designing the most amazing city setting, but if your players decide they want to travel from town to town, you have to be ready to break apart your setting and give them the way *they* want it.
Paranoia is the kind of game you DON'T run: You prepare each scenario, knowing full well the players are going to wreck it, and possibly each other (A best case scenario is a FPW in the first scene, caused by themselves <3 ). Then just let it happen.
Regardless of the game, I divide each scenario into 4 parts: Introduction, Setup, Climax and Conclusion. For each part, I write a couple of sentences on how the NPCs/World is going to move, and ways in which the PCs may get involved. When the unexpected happens, I improvise, keeping that structure in mind, so when a derail happens, I can change the setting to move up the NPCs agendas.
If you want to *avoid* "derailment", then design a setting with NO story, ask them to make characters and to give you THREE motivations, or three things that they want their characters to live/achieve. Then you plan the plot around those motivations!
Romance? Introduce multiple potential NPC partners, each with at least one good quality and bad quality. Spice!!
Adventure? Traveling around the world, catching criminals, recovering artifacts!
Horror? THE GREAT ONES THREATEN THE WORLD!! IA IA!!
ALL OF THE ABOVE?! A potential NPC partner gets kidnapped by an Egyptian cult led by YOG-SOTHOTH. Time to travel to ancient undiscovered ruins rife with treasure, deadly traps, cultists and maybe even looooove!!
Good luck, and happy gaming!