As a general rule in the United States, the terms lawyer and attorney mean essentially the same thing. The terms refer to a person trained in law, admitted to a bar association, and currently licensed to practice in a specific state or federal court. Some grammar sticklers may argue that attorney carries the additional meaning of being a person who is appointed to act for someone else in business or legal matters; however, in common usage, the words are essentially synonymous.
You may also see attorneys referred to as advocates or counsel. Counsel can be used as a singular or plural term, referring either to one attorney who gives legal advise or a group of legal advisors.
What Is An Esquire?
You may also see some attorneys signing their correspondence with the title of Esquire or Esq. While this usually signifies that someone is a currently licensed attorney, in the United States, there are no legal restrictions on who is allowed to use this title. Public officials, such as justices of the peace, may also sign their names in this fashion. While it would be strange for someone with no training or status in the legal system to do so, there's no restriction against it.
You may also see attorneys signing their correspondance as J.D., meaning that they are a Juris Doctor. Someone who uses this title has graduated from law school; however, it does not guarentee that this person is allowed to dispense legal advice. Lawyers and attorneys have been admitted to the bar; a Juris Doctor may be a lawyer or attorney, but could also be someone who has not yet taken the bar exam, has chosen not to take the bar exam, or has failed the bar exam.
In some areas of the world, however, there are nuances to certain titles that mean that they cannot be used interchangeably. Lawyer is used in some areas to mean anyone who can give legal aid and conduct suits in court. Calling someone an attorney or attorney-at-law implies that this person is a member of the legal profession who can represent clients in court.
In some areas of the world, attorneys are further subdivided in terminology based on what they do in and out of court. In the United Kingdom, a barrister does not deal directly with clients, but they can appear at the bar and conduct cases in open court. A solicitor in the United Kingdom can conduct litigation in court, but is not allowed to plead cases in open court. In the United States, these terms do not have the same meaning, and it is unlikely that someone involved in a legal case in America would refer to their legal advisor as a barrister or solicitor.