Barcelo v. Elliott is a Texas case which holds that privity is necessary for a legal malpractice case. Here is an article from Baylor Law Review, the TexSupp which discusses the case, its holding, and how the courts have gradually whittled away the privity requirement.
As in other states, ocassionlly an attorney may be held responsible to non-clients. Opinion letters, fraud, and some other conditions may apply.