Stabilised ylides, like the one in your example will form (2). The reason for this is the reversability of the addition to the C=O leads to the more thermodynamically stable product (2) with the stronger C=O intact.
Unstabilised ylides would form (1) - addition on unstabilised ylides to C=O is irreversable