The following are some of the techniques you can use to avoid a deadlock:
Access resources in the same physical order => the first transaction will successfully acquire locks on the resources without being blocked by the second transaction.
Decrease the locking
• Convert a nonclustered index to a clustered index.
• Use a covering index for a
Minimize lock contention
• Implement row versioning through the
READ_COMMITTED_SNAPSHOT isolation level or through the
SNAPSHOT isolation level
• Decrease the isolation level
• Use locking hints: