Yes.  Tension can vary if external forces are acting on the string - such as gravity (if the string has mass) and friction where the string makes contact with other objects (such as the pulley).

For example, suppose you attach one end A of a uniform massless string to a support and the other end C to a vertically hanging mass M.  This creates uniform tension Mg in the string everywhere between A and C.  

Now attach a mass m at B somewhere between A and C. Section BC is still supporting the same mass M, so the tension in section BC remains Mg.  Section AB is now supporting a mass M+m, so the tension in section AB increases to (M+m)g.  AB and BC are still part of the same string, but the tension in each section differs.