As Jiml alluded to above, the quality of the glass and its coatings makes major differences in the tendency to create lens flare. Lenses with really good glass and coatings start at about $800 and go up from there.
Some photographers actually prefer to get some lens flare in their images. But, in my opinion, as strictly an amateur photographer, keeping more than 1% of photos with significant lens flare is 'too much'. Sometimes, Photoshop can be used to remove or at least minimize some of the lens flare. But the issue is that the image itself is 'washed out' in the lens flare area making restoration difficult.
Perhaps the biggest cause of lens flare is light entering the lens at an 'oddball' angle other than within, say, 30-40 degrees of the centerline of the lens. Consider a night scene looking down a street with street lights as well as signs, etc. A street light 100' in front of the photographer and at 2 o'clock from the centerline of the lens, will likely produce lens flare in even the best of lenses. One of the best solutions to reduce the occurrences of lens flare is to use a lens hood designed for that lens. When shooting with my phone or compact camera, I've been known to put my cupped left hand over the front of the camera to prevent the sun or other bright lights from entering the lens at oddball angles. Note, too, that lens flare, like back lit scenes, almost always 'fool' the camera metering system resulting in an underexposed image that needs to be 'brightened up' in Photoshop, Lightroom, or other image editing software.