This is a common problem, and shades over into the issue of authorial voice. All Heinlein heroes do sound alike, because they were written by Robert Heinlein. But consider Dickens. There is a specific Dickensian voice; you can recognize a passage written by the great man easily, whether fiction or nonfiction. But all of Charles Dickens’ characters do sound different. They cannot be mistaken for one another even though they are all Dickensian. Clearly, this is a grand trick and worthy of emulation.
How to do it? Well, broadly speaking, it is part of character building. If you can fully develop each character, they will sound different, because real people do sound different. Consider any two persons in your circle of acquaintance. They cannot be mistaken for one another (except in very rare cases like twins or mimics). But there’s a hatful of minor tricks that writers can use to help this along.
Every person has a certain set of favorite words. She always says ‘frightful’, while he always says ‘grody.’ You could chart this. You could draw up a spreadsheet of each character and assign each one a couple or three words specific only to them. Go through with word search and put them in. Select a given ejaculation of exclamation, assign to a character, and see that she uses it and nobody else does.
Writers (Judy?) often cast their main characters the way movie producers do. At the very minimum we find an image of our hero inspiring. The task is greatly eased by the existence of IMDB. The current Mandy Patinkin a little too avuncular and balding for your hero? Slide back in time and find the dashing image of a more Inigo Montoya-like man. You can do this vocally too, although I would not use actors or audio books. Remember that actors say words written by others; Inigo Montoya spoke the words not of Mandy Patinkin but of William Goldman. There are many, many other people whose words exist in both text and audio format, that you could simply assign to various characters in your book — politicians and pundits are especially plenteous, and you can find their audio files on line. You say that listening to the words of the pastor of the Westboro Baptist Church makes you want to stick knitting needles into your eyes? Tch, all books need a villain, and a villain needs to sound characteristic too.
But suppose your characters are not modern. If they were all born around 1200 AD, you do not want to model their speech patterns upon Donald Trump. Your only recourse then is research. If the person was sufficiently well known his words may have been written down by contemporaries. If he was literate he may have written a lot himself. None of the above? Then you have to get creative. Reading the words of persons of the same time period will give you a sense of the words they used and the things they wrote about.
Every group or division in life has its own speech. Every parent of a teen who is reading this is nodding with agreement. Entire novels have been inspired merely by the thrilling dialect of some subgroup. (The classic example here is Gidget, which was a novel before it was a TV show or movie.) There are slight but noticeable regional variations in US English; the variation is larger if you include Britain. You don’t want to load the dialog with different accents, because it’ll drive you reader buggy. But cadence, word choice, rhythm, you could do. And this shades over into jargon, the specific words of professions. Anybody who has ever been in the theater, or in the military, has certain words built into their systems. Find them and use them.
There are other features of speech — squeaks, curses, even gesture. Assign a few to different characters. Keep it straight who is doing what.
What it finally comes down to is ear. You have to learn how to hear your characters. I’m reading a biography of Georgette Heyer, and apparently this was essential for her dialogue-heavy fiction. Every character had to have everything worked out — title, names, ancestry, speech — before she could begin writing. At that point all she would need to do is to let ’em go, and write as fast as she could while they galloped away with the plot.
The ebook version of my novel How Like a God is now available from Book View Cafe.
My newest novel Speak to Our Desires is out from Book View Café.