The CBC (Cipher Block Chaining) mode solves this issue of ECB: it uses the ciphertext of the current block to encrypt the next block, making blocks depend on one another (a.k.a., "chaining" them) and, thereby, eliminates pattern recognition!
Encryption using the Cipher Block Chaining (CBC) mode. WhiteTimberwolf (SVG version), Public domain, via Wikimedia Commons.
Decryption using the Cipher Block Chaining (CBC) mode. WhiteTimberwolf (SVG version), Public domain, via Wikimedia Commons
These notes by Miriam Briskman are licensed under CC BY-NC 4.0 and based on sources.