One can officially put the Esq. after their name once they become a member of the Bar. If you are really strict about etiquette, technically Esq. is a honorific used only by males; for females, use "Attorney at Law." (This rule is being used less and less)
Until they pass the bar, or if they choose not to take the bar, they may use "John Smith, J.D."
In an academic setting, it is also permissible to use "Dr. John Smith."
Hope this helps.