You can answer based on composition or technique, whichever you prefer to discuss, or you can discuss both. When I wrote the OP I was thinking in terms of composition - both songwriting and improvising solos but especially songwriting.
When I was just a couple years into playing guitar I would try to write songs in the style of Judas Priest - my favorite band - and it never worked out. Turns out my natural style is just too different from theirs for that to have ever worked out.
One thing that helped me form my own style of writing songs was discovering the band Unorthodox. I learned quite a few of their songs. I even transcribed a long song of theirs named “Harvest” which took me at least 7 pages of paper to write all the tablature for it. After that I noticed myself starting to write my own songs that were still in the same genre of metal that Unorthodox plays. I was basically taking their style and then adding my own personal creativity to it and coming up with something new. The beauty of it was that I’d found a band that had a guitarist who thought the way I do. By listening to him I was able to learn how to take my own ideas and turn them into complete songs. The bands I’d liked and listened to before Unorthodox just thought very differently from how I naturally think. Finally I;d found a guitarist who thought like me and so it was very easy for me to write in his style.
There’s a danger in that however. When you base your songs on just one band’s stye you end up sounding too much like them. Phil Anselmo has spoken about this phenomenon a lot. He talks about how when they started out they’d take their favorite 8 or 10 bands and then using them as inspiration, write their originals. Anselmo says that today, far too many bands only take two bands they like and write all their songs based on riffs they learned from those two songs and he said “that doesn’t work.” He said words to the effect of it just ends up as plagiarism when a band only listens to two bands and takes all their influence from those two bands. He seems to be heavily implying that an awful lot of ands have copied Pantera but haven’t used enough other bands as influences for the result to be anything original.
Ritchie Blackmore has said everyone in rock including the greats steal. It’s one thing when a band steals ideas from a dozen different bands and then adds their own unique creative ideas to it. That works. Trying that but only using two or three bands as influences doesn’t work well.
After a couple years of writing almost exclusively in the style of Unorthodox I started incorporating different creative ideas to the music I was writing - ideas that were unlike anything I’d heard Unorthodox ever play. Then I was well on my way to having my own unique style. To this day you can hear some Unorthodox influence in some of the stuff I write and in other songs I write there is no Unorthodox influence whatsoever. I’ve learned how to incorporate my various influences into something very original. Unorthodox was the band that first set me on the path to finding my own style of songwriting though and for that they were invaluable. Regarding guitar solos, Dale (the guitarist in Unorthodox) and I have entirely different styles.