The steamship Titanic hit an iceberg.
The steamship, Titanic, hit an iceberg.
Only the first one, which is a restrictive appositive, is correct: the proper name "Titanic" defines the steamship being referred to.
Alternatively, you can use a non-restrictive apposition with commas where the common noun merely provides extra information about the proper name, but in that case the order will be different:
- Titanic, the steamship, hit an iceberg.