D&D is probably my favorite RPG nowadays - mostly in the OSR versions, but even 5e sometimes. But one of the things I dislike the most about it is picking spells: there is a HUGE number to choose from, and depending on the system you get to choose EVERY DAY which spells you'll prepare.
I have my own "fixes" to that - which I included in Alternate Magic.
But there is a "fix" I haven't tried much - is just forcing spellcasters to FIND their spells, in scrolls, grimoires, etc.
And it makes sense. Not only because it saves time, but because fighters must find their own magic, too - magic weapons, magic armor, and so on. Both modern and old school versions of D&D assume fighters will get those weapons, but not be able to CHOOSE a Flame Tongue or Vorpal Sword at level 10, for example.
Maybe you can BUY spells if other magic items are available for sale (although a functioning magical economy would encourage all casters to buy the "best" spells unless they are more expensive). Maybe you can ask a specific spell from your deity. Ideally, you'd go on a quest. I prefer to be agnostic about this. Maybe you can even choose a small number of spells. The important part is - do not assume you'll be able to choose new spell as you gain new levels.
This doesn't only make character creation and improvement infinitely faster and easier, but avoids any worry about "balancing" spells, and keeps magic mysterious and unpredictable. It will make wizards crave rare grimoires like fighters crave magic swords. Spellcasters are now shaped by their quests and experiences instead of an "optimal builds".
We probably should consider a roll for learning a spell (see AD&D 1e); some people are unable to learn some spells. I've seem it time and time again when playing D&D: the party defeats a wizard, and wants to learn his spells. It's great!
No two spellcasters are identical. Of course, casters will choose the best spells AVAILIABLE, but what is available will change from campaign to campaign.
(BTW, after you learn a spell, it should be HARD to forget it. Spells are living things. Dark Fantasy Basic has a system that will make spells invade your mind if you use scrolls too often).
Now you only need a spell list of generator. I like this one from Cairn if you want something free-form. There are generators for 5e. And if you're playing OSE, just roll a 1d6 to find spell level and 1d12 to choose a spell. Alternate Magic has 12 cleric spells and 12 magic-user spells, all of them very flexible; just roll 1d12 and flip a coin. And so on.