The common carotid artery (CCA) is a source of important information that doctors can use to evaluate the patients health. The most often measured parameters are arterial stiffness, lumen diameter, wall thickness, and other parameters where variation with time is usually measured. Unfortunately, the manual measurement of dynamic parameters of the CCA is time consuming, and therefore, for practical reasons, the only alternative is automatic approach. The initial localization of artery is important and must precede the main measurement. This article describes a novel method for the localization of CCA in the transverse section of a B mode ultrasound image. The novel method was designed automatically by using the grammar-guided genetic programming (GGGP). The GGGP searches for the best possible combination of simple image processing tasks (independent building blocks). The best possible solution is represented with the highest detection precision. The method is tested on a validation database of CCA images that was specially created for this purpose and released for use by other scientists. The resulting success of the proposed solution was 82.7%, which exceeded the current state of the art by 4% while the computation time requirements were acceptable. The paper also describes an automatic method that was used in designing the proposed solution. This automatic method provides a universal approach to designing complex solutions with the support of evolutionary algorithms.