Well, ultimately the history books will show it as Undertaker because WWE bought history.
I also think the time in TNA (until WWE buys their tape library, and probably even still then) hurt Sting's legacy.
That said, if we factor truth into the equation, Undertaker was largely rewarded for his loyalty during the mid '90s when virtually every star but Shawn, Bret, and him jumped shipped. His contributions though are often overstated. While he was certainly a present figure in the attitude era, I could easily argue that he was often shoehorned into angles and was a much more insignificant part of the reason for the success of that era than his contemporaries. He did go on to have some classic matches at WM certainly, but a lot of the magic of those matches was propelled by the streak, which we much remember was entirely the result of booking, and nothing to do with him as a performer. So while all those near falls made the hair on your neck stand up as the years went on, that was a product of favorable booking. If it had been anyone else in that role it may have helped to create similar drama for their matches. I will never discredit Taker's longevity, ability to stay relevant, and put on quality matches well past most people's retirement age.
Sting on the other hand, I actually think was the better overall performer in both match quality and mic skills, but he also had a lot of quality opponents to work with, namely Flair. If we were only comparing them up until 2001, then without a doubt I'd give the nod to Sting. However, in the post WCW era, their careers went on very different trajectories simply due to logistics and booking, so it's hard to make a fair comparison after that.
I personally like Sting better as a person. I think Undertaker has overstayed his welcome and his "a little too convenient" excuses of not wanting to break character to get out of doing things has started to rub me the wrong way, as he can break it to be in a motorcycle video, or ya know for the whole American Badass gimmick, but not to induct Paul Bearer in the HOF for example. I think Sting is much more down to earth, normal, humble guy, who does right for the business, and Taker strikes me as the kind of guy that will only allow his legacy to be touched for a friend like Lesnar, but otherwise has no problem chumping out someone like Bray Wyatt.