This pretty yellow and black longhorn beetle is the Locust Borer (Megacyllene robiniae), they are serious pests of Black Locust trees and are found throughout most of the United States. Each autumn females will lay eggs in the Black Locust trees, those eggs hatch and the resulting larvae will overwinter under the bark of the trees. In the spring they become active as the temperatures begin to rise, and they will tunnel into the trees. Often times these tunnels are up to 4 inches in depth, and the constant feeding of these grubs may kill trees that are already stressed or weakened. In areas where these beetles are prevalent the damage to stands of Locust Trees may be severe.
There are other Black and Yellow Longhorns, namely the Hickory Borer. The Hickory Borer is active during the spring, whereas the Locust Borer is active in the fall. Be able to identify your trees also, this will go a long way in determining which beetle you are looking at. Locust Borers are associated with the Black Locust and its cultivars, the Hickory Borer is associated with Hickory and Pecan Trees.
These are not a large beetle, the females measure up to 3/4 of an inch, males are smaller at approximately 1/2 inch. Look for them now in areas where goldenrod is in bloom. The adults are nectar feeds and go bonkers over goldenrod. I photographed these beetles at my husbands uncles place. His farm has numerous black locust trees and the goldenrod is everywhere. Which happens to provide the perfect habitat for these beetles, and I must say they were everywhere. Gauging by the activity in the following picture, their numbers won't soon decline either.